package com.mxpio.erp.plan.mrp;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.mxpio.erp.common.technology.entity.VBomInfo;
import com.mxpio.erp.common.technology.vo.ItemWithSubExtendsVO;
import com.mxpio.erp.common.workshop.entity.ManufactureOrderItem;
import com.mxpio.erp.plan.mrp.bo.CountModel;

public class Context {
	
	private CountModelMap<CountModel> storage;//Map<String, CountModel>

	private CountModelMap<List<CountModel>> orderCount;//Map<String, List<CountModel>>

	private CountModelMap<List<CountModel>> purchaseOrderCount;//Map<String, List<CountModel>>

	private CountModelMap<List<CountModel>> salesOrderCount;//Map<String, List<CountModel>>
	
	private Map<String, List<ManufactureOrderItem>> orderLines;
	
	private CountModelMap<CountModel> lotCount;
	
	private Map<String, ItemWithSubExtendsVO> items;
	
	private Map<String, List<VBomInfo>> boms;
	
	private Map<String, ItemWithSubExtendsVO> purchaseItems;
	
	private CountModelMap<List<CountModel>> resultCount;//Map<String, List<CountModel>>
	
	private CountModelMap<List<CountModel>> allmodels;//Map<String, List<CountModel>>
	
	private boolean includeMO = true;
	
	private boolean includePO = true;
	
	private boolean includeSG = true;
	
	private boolean includeSO = true;
	
	private List<String> itemIndexFields = new ArrayList<>();
	
	private String itemIndexDefaultValue = "0";
	
	public static Context defaultContext(){
		Context context = new Context();
		List<String> itemIndexFields = new ArrayList<>();
		context.setItemIndexDefaultValue("0");
		context.setItemIndexFields(itemIndexFields);
		return context;
	}
	
	public static Context orderSetContext(){
		Context context = new Context();
		context.setIncludeMO(true);
		context.setIncludePO(false);
		context.setIncludeSG(true);
		context.setIncludeSO(false);
		return context;
	}

	public CountModelMap<CountModel> getStorage() {
		if(storage == null){
			storage = new CountModelMap<>();
		}
		return storage;
	}

	public void setStorage(CountModelMap<CountModel> storage) {
		this.storage = storage;
	}

	public CountModelMap<List<CountModel>> getOrderCount() {
		if(orderCount == null){
			orderCount = new CountModelMap<List<CountModel>>();
		}
		return orderCount;
	}

	public void setOrderCount(CountModelMap<List<CountModel>> orderCount) {
		this.orderCount = orderCount;
	}

	public CountModelMap<List<CountModel>> getPurchaseOrderCount() {
		if(purchaseOrderCount == null){
			purchaseOrderCount = new CountModelMap<List<CountModel>>();
		}
		return purchaseOrderCount;
	}

	public void setPurchaseOrderCount(CountModelMap<List<CountModel>> purchaseOrderCount) {
		this.purchaseOrderCount = purchaseOrderCount;
	}

	public CountModelMap<List<CountModel>> getSalesOrderCount() {
		if(salesOrderCount == null){
			salesOrderCount = new CountModelMap<List<CountModel>>();
		}
		return salesOrderCount;
	}

	public void setSalesOrderCount(CountModelMap<List<CountModel>> salesOrderCount) {
		this.salesOrderCount = salesOrderCount;
	}

	public Map<String, ItemWithSubExtendsVO> getItems() {
		return items;
	}

	public void setItems(Map<String, ItemWithSubExtendsVO> itemExtendsMap) {
		this.items = itemExtendsMap;
	}

	public boolean isIncludeMO() {
		return includeMO;
	}

	public void setIncludeMO(boolean includeMO) {
		this.includeMO = includeMO;
	}

	public boolean isIncludePO() {
		return includePO;
	}

	public void setIncludePO(boolean includePO) {
		this.includePO = includePO;
	}

	public boolean isIncludeSG() {
		return includeSG;
	}

	public void setIncludeSG(boolean includeSG) {
		this.includeSG = includeSG;
	}

	public boolean isIncludeSO() {
		return includeSO;
	}

	public void setIncludeSO(boolean includeSO) {
		this.includeSO = includeSO;
	}

	public Map<String, ItemWithSubExtendsVO> getPurchaseItems() {
		return purchaseItems;
	}

	public void setPurchaseItems(Map<String, ItemWithSubExtendsVO> purchaseItemExtendsMap) {
		this.purchaseItems = purchaseItemExtendsMap;
	}

	public CountModelMap<List<CountModel>> getResultCount() {
		if(resultCount == null){
			resultCount = new CountModelMap<List<CountModel>>();
		}
		return resultCount;
	}

	public void setResultCount(CountModelMap<List<CountModel>> resultCount) {
		this.resultCount = resultCount;
	}

	public CountModelMap<List<CountModel>> getAllmodels() {
		if(allmodels == null){
			allmodels = new CountModelMap<List<CountModel>>();
		}
		return allmodels;
	}

	public void setAllmodels(CountModelMap<List<CountModel>> allmodels) {
		this.allmodels = allmodels;
	}

	public List<String> getItemIndexFields() {
		return itemIndexFields;
	}

	public void setItemIndexFields(List<String> itemIndexFields) {
		this.itemIndexFields = itemIndexFields;
	}

	public String getItemIndexDefaultValue() {
		return itemIndexDefaultValue;
	}

	public void setItemIndexDefaultValue(String itemIndexDefaultValue) {
		this.itemIndexDefaultValue = itemIndexDefaultValue;
	}

	public Map<String, List<VBomInfo>> getBoms() {
		if(boms == null){
			boms = new HashMap<>();
		}
		return boms;
	}

	public void setBoms(Map<String, List<VBomInfo>> boms) {
		this.boms = boms;
	}

	public CountModelMap<CountModel> getLotCount() {
		if(lotCount == null){
			lotCount = new CountModelMap<CountModel>();
		}
		return lotCount;
	}

	public void setLotCount(CountModelMap<CountModel> lotCount) {
		this.lotCount = lotCount;
	}

	public Map<String, List<ManufactureOrderItem>> getOrderLines() {
		if(orderLines == null){
			orderLines = new HashMap<String, List<ManufactureOrderItem>>();
		}
		return orderLines;
	}

	public void setOrderLines(Map<String, List<ManufactureOrderItem>> orderLines) {
		this.orderLines = orderLines;
	}

}
